{include file="public_iframe:head"}

<div class="wrapper wrapper-content animated fadeInRight">
	<div class="ibox float-e-margins">
		<div class="ibox-title">
			<h5>管理员编辑</h5>
			<div class="ibox-tools" style="margin-top: -9px;">
				<button onclick="history.go(-1);" class="btn btn-primary"><i class="fa fa-arrow-left"></i> 返回</button>
			</div>
		</div>
		<div class="ibox-content">
			<form action="{:url('Admin/add')}" method="post" enctype="multipart/form-data" id="brandForm" class="form-horizontal">
				<input type="hidden" name="id" value="{$res.id}"/>
				<input type="hidden" name="old_account" value="{$res.account}"/>
				<input type="hidden" name="old_password" value="{$res.password}"/>
				<div class="form-group">
					<label class="col-sm-2 control-label">管理员账号</label>

					<div class="col-sm-6">
						<input type="text" class="form-control" value="{$res.account}" name="account" id="account" placeholder="管理员账号...">
					</div>
				</div>
				<div class="hr-line-dashed"></div>
				<div class="form-group">
					<label class="col-sm-2 control-label">管理员角色</label>

					<div class="col-sm-6">
						<select class="form-control m-b" name="role_id" id="">
							{volist name="role" id="vo"}
								<option value="{$vo['role_id']}" {if condition="$res.role_id eq $vo['role_id']"}selected="selected"{/if}>{$vo['role_name']}</option>
							{/volist}
						</select>
					</div>
				</div>
				<div class="hr-line-dashed"></div>
				<div class="form-group">
					<label class="col-sm-2 control-label">管理员密码</label>

					<div class="col-sm-6">
						<input type="password" class="form-control" name="passwd" id="passwd" placeholder="管理员密码..." value="" />
					</div>
				</div>
				<div class="hr-line-dashed"></div>
				<div class="form-group">
					<label class="col-sm-2 control-label">确认密码</label>

					<div class="col-sm-6">
						<input type="password" class="form-control" name="repasswd" id="repasswd" placeholder="确认密码..." value="" />
					</div>
				</div>
				<div class="hr-line-dashed"></div>
				<div class="form-group">
					<label class="col-sm-2 control-label">真实姓名</label>

					<div class="col-sm-6">
						<input type="text" class="form-control" value="{$res.real_name}" name="real_name" id="real_name" placeholder="真实姓名...">
					</div>
				</div>
				<div class="hr-line-dashed"></div>

				<div class="form-group">
					<div class="col-sm-4 col-sm-offset-2">
						<button class="btn btn-primary" id="submit" type="submit">提交</button>
						<!--<button class="btn btn-white" type="submit">取消</button>-->
						<!--<input type="button" class="btn btn-primary" value="提交"/>-->
					</div>
				</div>
			</form>
		</div>
	</div>
	<!-- End Panel Basic -->
</div>
<script src="__STATIC__/admin/js/jquery.min.js?v=2.1.4"></script>
<script type="text/javascript">
$(document).ready(function(){
	
 //tab
 $(".admin_tab li a").click(function(){
  var liindex = $(".admin_tab li a").index(this);
  $(this).addClass("active").parent().siblings().find("a").removeClass("active");
  $(".admin_tab_cont").eq(liindex).fadeIn(150).siblings(".admin_tab_cont").hide();
 });
 $("#submit").click(function(){

	if($("#account").val()==""){
		parent.layer.alert("管理员账号不能为空!",{
			shade: false //不显示遮罩
			});
		return false;
	}

	if($("#passwd").val()==""){
		parent.layer.alert("管理员密码不能为空!",{
			shade: false //不显示遮罩
		});
		return false;
	}

	if($("#passwd").val()!=$("#repasswd").val()){
		parent.layer.alert("两次密码不一样!",{
			shade: false //不显示遮罩
		});
		return false;
	}
	if($("#real_name").val()==""){
		parent.layer.alert("真实姓名不能为空!",{
			shade: false //不显示遮罩
		});
		return false;
	}
	if($("#phone").val()==""){
		parent.layer.alert("联系电话不能为空!",{
			shade: false //不显示遮罩
		});
		return false;
	}
	if($("#address").val()==""){
		parent.layer.alert("联系地址不能为空!",{
			shade: false //不显示遮罩
		});
		return false;
	}
	$("#brandForm").submit();
 });

 });
</script>

 </div>
</section>
</body>
</html>
